package com.tanhua.app.controller;

import com.tanhua.app.controllerservice.TanHuaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/tanhua")
public class TanHuaController {

    @Autowired
    private TanHuaService tanHuaService;

    @GetMapping(name = "今日佳人查询",value = "/todayBest")
    public ResponseEntity todayBest(){

        return tanHuaService.todayBest();
    }

    @GetMapping(name = "佳人信息的分页展示",value = "/recommendation")
    public ResponseEntity recommendation(Integer page,Integer pagesize){

        return tanHuaService.recommendation(page,pagesize);
    }


    @GetMapping(name = "佳人个人详情展示",value = "/{id}/personalInfo")
    public ResponseEntity personalInfo(@PathVariable("id") Integer jrid){
        return tanHuaService.personalInfo(jrid);
    }


    @GetMapping(name = "查询陌生人问题",value = "/strangerQuestions")
    public ResponseEntity strangerQuestions(Integer userId){
        return tanHuaService.strangerQuestions(userId);
    }


    @PostMapping(name = "发送验证消息",value = "/strangerQuestions")
    public ResponseEntity toStrangerQuestions(@RequestBody Map map){

        Integer userId =(Integer) map.get("userId"); //115
        String info =(String) map.get("reply"); //是的
        System.out.println(userId);
        System.out.println(info);
        return tanHuaService.toStrangerQuestions(userId,info);
    }





}
